package com.situ.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.situ.service.BeFlowService;
import com.situ.entity.BeFlow;
import java.util.*;
/**
 * BeFlow的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class BeFlowController {

	/** BeFlowService服务 */
	@Autowired
	private BeFlowService beFlowService;
	
	/**
	 * 查询所有BeFlow数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryBeFlow", produces = {"application/json;charset=UTF-8"})
	public String find(BeFlow value,Map map) {
		 List<BeFlow> list= beFlowService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询BeFlow数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryBeFlowById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Integer id,Map map) {
        BeFlow obj=  beFlowService.findOne(id);
        map.put("BeFlow",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入BeFlow属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveBeFlow", produces = {"application/json;charset=UTF-8"})
	public String save(BeFlow value) {
		  beFlowService.saveNotNull(value);
        return "redirect:/queryBeFlow";
	}
	
	/**
	 * 更新BeFlow属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateBeFlow", produces = {"application/json;charset=UTF-8"})
	public String update(BeFlow value) {
		  beFlowService.updateNotNullById(value);
          return "redirect:/queryBeFlow";
	}
	
	/**
	 * 通过id删除BeFlow数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delBeFlowById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Integer id) {
		  beFlowService.deleteById(id);
          return "redirect:/queryBeFlow";
	}
	//雷雯：业扩工程进度的报表
	@RequestMapping(value = "cxstat")
	public String statements(Model model){
		List<Map> flow=beFlowService.CxStatements();

		model.addAttribute("flows", flow);
		return "be_reportProgress.html";
	}
}
